<?php

class Users_Form_Userpassword extends Zend_Form {

    protected $_translate = null;

    public function init() {
        $this->_translate = Zend_Registry::get('Zend_Translate');
        $this->setAction('/users/password')
                ->setMethod('post');

        //old password
        $old = new Zend_Form_Element_Password('old');
        $old->setLabel($this->_translate->_('password'))
                ->addValidator('StringLength', false, array(6))
                ->setOptions(array('placeholder' => $this->_translate->_('password_placeholder')))
                ->setRequired(true);

        //new password 1
        $new1 = new Zend_Form_Element_Password('new1');
        $new1->setLabel($this->_translate->_('new_password'))
                ->addValidator('StringLength', false, array(6))
                ->setOptions(array('placeholder' => $this->_translate->_('new_password_placeholder')))
                ->setRequired(true);

        //new password confirm
        $new2 = new Zend_Form_Element_Password('new2');
        $new2->setLabel($this->_translate->_('confirm_password'))
                ->addValidator('StringLength', false, array(6))
                ->setOptions(array('placeholder' => $this->_translate->_('confirm_password_placeholder')))
                ->setRequired(true);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($this->_translate->_('change_password'))
                ->setAttrib('class', 'btn btn-success');


        $this->addElements(array($old, $new1, $new2, $submit));
    }

}

